package com.yanqu.road.entity.activity.sonhai.config;

import com.yanqu.road.utils.RandomHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SonHaiFloorConfig {

    /**
     * 活动id
     */
    private int activityId;

    /**
     * 区域id
     */
    private int id;

    /**
     * 层数
     */
    private int floor;

    /**
     * 关卡名称
     */
    private String name;

    /**
     * 消耗体力
     */
    private int energy;

    /**
     * 攻打兽王所需寻踪进度
     */
    private int needSchedule;

    /**
     * 兽王ID
     */
    private int special;

    /**
     * 事件权重事件id10万分比
     */
    private String eventWeight;
    private Map<Integer, Long> eventWeightMap = new HashMap<>();

    /**
     * 事件数量限制事件id数量上限没数量上限的没配
     */
    private String eventNum;
    private Map<Integer, Integer> eventNumMap = new HashMap<>();

    /**
     * buff权重（buff id；10万分比）
     */
    private String buffWeight;
    private Map<Integer, Long> buffWeightMap = new HashMap<>();

    /**
     * 怪物血量修正值千分比
     */
    private int monsterHpAdd;

    /**
     * 推荐战力
     */
    private int power;

    /**
     * buff数量
     */
    private int buffNum;

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getActivityId() {
        return activityId;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setFloor(int floor) {
        this.floor = floor;
    }

    public int getFloor() {
        return floor;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setEnergy(int energy) {
        this.energy = energy;
    }

    public int getEnergy() {
        return energy;
    }

    public void setNeedSchedule(int needSchedule) {
        this.needSchedule = needSchedule;
    }

    public int getNeedSchedule() {
        return needSchedule;
    }

    public int getSpecial() {
        return special;
    }

    public void setSpecial(int special) {
        this.special = special;
    }

    public void setEventWeight(String eventWeight) {
        this.eventWeight = eventWeight;
        //解析一下
        if (!StringUtils.isNullOrEmpty(eventWeight)) {
            Map<Integer, Long> eventWeightMap = new HashMap<>();
            String[] eventArr = eventWeight.split("\\|");
            for (String eventStr : eventArr) {
                String[] itemArr = eventStr.split(";");
                int eventId = Integer.parseInt(itemArr[0]);
                long weight = Long.parseLong(itemArr[1]);
                eventWeightMap.put(eventId, weight);
            }
            this.eventWeightMap = eventWeightMap;
        }
    }

    public String getEventWeight() {
        return eventWeight;
    }

    public void setEventNum(String eventNum) {
        this.eventNum = eventNum;
        //解析一下
        Map<Integer, Integer> eventNumMap = new HashMap<>();
        if (!StringUtils.isNullOrEmpty(eventNum)) {
            String[] eventArr = eventNum.split("\\|");
            for (String eventStr : eventArr) {
                String[] itemArr = eventStr.split(";");
                int eventId = Integer.parseInt(itemArr[0]);
                int num = Integer.parseInt(itemArr[1]);
                eventNumMap.put(eventId, num);
            }
        }
        this.eventNumMap = eventNumMap;
    }

    public String getEventNum() {
        return eventNum;
    }

    public Map<Integer, Long> getEventWeightMap() {
        return eventWeightMap;
    }

    public Map<Integer, Integer> getEventNumMap() {
        return eventNumMap;
    }

    public void setMonsterHpAdd(int monsterHpAdd) {
        this.monsterHpAdd = monsterHpAdd;
    }

    public int getMonsterHpAdd() {
        return monsterHpAdd;
    }

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }

    public int getBuffNum() {
        return buffNum;
    }

    public void setBuffNum(int buffNum) {
        this.buffNum = buffNum;
    }

    public String getBuffWeight() {
        return buffWeight;
    }

    public void setBuffWeight(String buffWeight) {
        this.buffWeight = buffWeight;
        //解析一下
        if (!StringUtils.isNullOrEmpty(buffWeight)) {
            Map<Integer, Long> map = new HashMap<>();
            String[] arr = buffWeight.split("\\|");
            for (String str : arr) {
                String[] itemArr = str.split(";");
                int id = Integer.parseInt(itemArr[0]);
                long weight = Long.parseLong(itemArr[1]);
                map.put(id, weight);
            }
            this.buffWeightMap = map;
        }
    }

    public Map<Integer, Long> getBuffWeightMap() {
        return buffWeightMap;
    }
}
